
<%@page import="org.lxy.domain.RecordLogEntity"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
    <title>用户管理 </title>
    <base href="<%=basePath %>"/>
    <link rel="Stylesheet" type="text/css" href="css/Form.css" />
    <link href="../../style/css.css" rel="stylesheet" type="text/css" />
    <link rel="Stylesheet" type="text/css" href="css/themes/base/jquery.ui.all.css" />
    <script type="text/javascript" src="js/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="js/jquery-ui-1.10.3.custom.js"></script>
    <script type="text/javascript" src="js/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript">

        $(function () {
            var role = $("#txtRole").val();

            if (role == "3") {
                $("#btnAdd").hide();
            }
            if (role == "2") {
                $("#btnAdd").hide();
                $("#btnEdit").hide();

            }
        });
        function Add() {
        	var url = "duihuanjiluServlet?op=Add";
            $("#EditFrame").attr("src", "duihuanjiluServlet?op=Add");
            $("#EditDialog").dialog({ bgiframe: true, height: 450, width: 300, modal: true });
            $("#EditDialog").dialog('open');
        }
        function Update() {
            var icount = getCount();
            if (icount == 0) {
                alert('请选择一条数据进行修改！');
                return;
            }
            if (icount > 1) {
                alert('只能同时修改一条数据！');
                return;
            }
            $("#EditFrame").attr("src", "duihuanjiluServlet?op=Edit&ID=" + $("input[type = 'checkbox'][name = 'checkuser']:checked").val() + "&update=1");
            $("#EditDialog").dialog({ bgiframe: true, height: 450, width: 300, modal: true });
            $("#EditDialog").dialog("open");
        }
        function Delete() {
            var icount = getCount();
            if (icount == 0) {
                alert("请选择要删除的数据！");
                return false;
            }
            else {
                if (confirm("确定要删除当前选择的 " + icount + " 条数据吗？")) {
                    //执行删除的操作
                    var ids ="";
                    $("input[type='checkbox'][name='checkuser']:checked").each(function(){
                    	ids+=$(this).val()+",";
                    });
                    $.post("duihuanjiluServlet?op=Delete",{ids:ids},function(data){
                    if(data=="1"){
                    	alert("删除成功！");
                    	
                    }
                    else{
                    	alert("删除失败！");
                    }
                    window.location.reload();
                    });
                }
                else {
                    return ;
                }
            }
        }
        
        function getCount() {
            return $("input[type='checkbox'][name='checkuser']:checked").length;
        }
        function closedialog() {
            $("#EditDialog").dialog('close');
        }
       
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <input type="hidden" id="txtRole" value="<%=request.getParameter("role") %>"/>
        <div class="position">
            当前位置 > duihuanjilu
        </div>
        <div>
            <div class="line">
            </div>
            <div class="search">
                 <input type="button" value="删除" onclick="Delete()" class="btn_css  submitbg"/>
            </div>
            <table id="gvUser" class="table_list" cellpadding="0">
            <tr>
			 <th>选择</th>
           <th>duihuanren</th><th>wupinid</th><th>duihuanshijian</th>
            </tr>
         <%
            if(request.getAttribute("list")!= null){
              ArrayList<duihuanjilu> duihuanjilulist =(ArrayList<duihuanjilu>) request.getAttribute("list") ;
              for(duihuanjilu duihuanjilu:duihuanjilulist){
          %>
<tr>
		   <td><input type="checkbox" name="checkuser" value=<%=duihuanjilu.getId() %> /> </td>
          
		  <td> <%=duihuanjilu.getDuihuanren() %> </td><td> <%=duihuanjilu.getWupinid() %> </td><td> <%=duihuanjilu.getDuihuanshijian() %> </td>
</tr>
		  <%
              }
           }
             %>
             </table>
        </div>
        <div id="EditDialog" title="编辑" style="display: none;">
            <iframe id="EditFrame" frameborder="0" width="100%" height="100%"></iframe>
        </div>
    </form>
</body>
</html>
